package com.ubi.core.framework.job;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.util.Assert;

import javax.annotation.PostConstruct;

/**
 * Created by Administrator on 2014/11/12.
 */
public abstract class SchedulerJob extends Job {

    protected String cronExpression;

    @Autowired
    ConfigurableEnvironment environment;

    @PostConstruct
    protected void jobPostConstruct() {
        Assert.notNull(environment);
    }

    @Override
    public void exceptionHandler(Exception e) {

        // TODO(Kent): send mail here if job failed

    }

    public String getCronExpression() {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression) {
        this.cronExpression = cronExpression;
    }
}
